<? $page_title='月采购汇总表' ?>
<?include "FASHION/page_header.phtml"?>
<div id="printArea">
<table class="ptop" border="0" cellpadding="4" cellspacing="0" width="100%">
         <thead>
            <tr class="nobg">
                <th><h2><?$print_com_name?></h2></th>
            </tr>
            <tr class="nobg">
                <th><h1><?$page_title?></h1></th>
            </tr>
        </thead>        
    </table>
<table border=0 class="list pcontent" width="100%">
    <thead>
        <tr class="nobg">
            <th>序号</th>
            <th>供应商</th>
            <th>价款</th>
    <{foreach from=$dlist key=dept_id item=dept}>
            <th width="80"><{$dept}></th>
    <{/foreach}>
            <th>类型</th>
            <th>备注</th>
        </tr>
    </thead>
    <tbody>
<!-- <{$index++}> -->
<{if $list}><{foreach item=supplier key=supplier_id from=$list}>
<{if $supplier.total!='0.00'}>
	<tr class="nobg">
		<td rowspan="<?= count($supplier.types)+2 ?>"><{=$index++}></td>
		<td rowspan="<?= count($supplier.types)+1 ?>"><{$supplier.supplier_name}></td>
		<td colspan="<?= count($dlist)+2 ?>" style="height:0;padding:0;border:0;"></td>
		<td rowspan="<?= count($supplier.types)+2 ?>">&nbsp;</td>
	</tr>
	<{foreach item=type key=type_id from=$supplier.types}>
	<tr>
<!--		<td><{$supplier.supplier_name}></td>-->
		<td><div class="decimal fnum"><{$type.total}></div></td>
		<{foreach from=$dlist key=dept_id item=dept}>
			<td><div class="decimal fnum"><{if $type.depts[$dept_id]}><{$type.depts[$dept_id].total}><{/if}></div></td>
		<{/foreach}>
		<td><?= DemandHelper::type2text($type_id) ?></td>
	</tr>
	<{/foreach}>
	<tr>
		<td>小计:</td>
		<td><div class="decimal fnum"><{$supplier.total}></div></td>
		<td colspan="<?= count($dlist)+1 ?>">&nbsp;</td>
	</tr>
        <{/if}>
<{/foreach}><{/if}>
        <tr>
            <td colspan="<?=count($dlist)+5?>">
                <table border="0" class="list">
                        <tr>
                                <th>&nbsp;</th>
                                <th>金额（元）</th>
                                <th>百分比</th>
                        </tr>
                        <tr>
                                <td>总计</td>
                                <td><div class="decimal fnum"><{$sumtotal}></div></td>
                                <td>100.00%</td>
                        </tr>
                        <{foreach item=score key=type_id from=$demandtypes}>
                        <tr>
                                <td><?= DemandHelper::type2text($type_id) ?></td>
                                <td><div class="decimal fnum"><{$score}></div></td>
                                <td><{if $sumtotal}><{= sprintf('%.02f',100*($score/$sumtotal)) }>%<{/if}></td>
                        </tr>
                        <{/foreach}>
                </table>
            </td>
        </tr>
    </tbody>
</table>

</div>
<?include "FASHION/page_footer.phtml"?>
